import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ImgInfoVO, ImgInfoForm, ImgInfoQuery } from '@/api/tearoom/imgInfo/types';

/**
 * 查询贴图管理列表
 * @param query
 * @returns {*}
 */

export const listImgInfo = (query?: ImgInfoQuery): AxiosPromise<ImgInfoVO[]> => {
  return request({
    url: '/tearoom/imgInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询贴图管理详细
 * @param id
 */
export const getImgInfo = (id: string | number): AxiosPromise<ImgInfoVO> => {
  return request({
    url: '/tearoom/imgInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增贴图管理
 * @param data
 */
export const addImgInfo = (data: ImgInfoForm) => {
  return request({
    url: '/tearoom/imgInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改贴图管理
 * @param data
 */
export const updateImgInfo = (data: ImgInfoForm) => {
  return request({
    url: '/tearoom/imgInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除贴图管理
 * @param id
 */
export const delImgInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/imgInfo/' + id,
    method: 'delete'
  });
};

/**
 * 修改状态
 * @param data
 */
export const changeImgInfoStatus = (id: number | string, status: number) => {
  const data = {
    id,
    status
  };
  return request({
    url: '/tearoom/imgInfo/changeStatus',
    method: 'put',
    data: data
  });
};
